<extend name="Public/base"/>
<block name="content">
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">管理员列表</strong>  <small></small></div>
      </div>

      <hr>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
              <a href="{:U('admin/add_admin')}" type="button" class="am-btn am-btn-primary"><span class="am-icon-plus"></span> 新增</a>
            </div>
          </div>
        </div>
      </div>

      <div class="am-g">
        <div class="am-u-sm-12">
          <form class="am-form">
            <table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
                <th class="table-id">序号</th>
                <th class="table-title">登录帐号</th>
                <th class="table-type">真实姓名</th>
                <th class="table-author am-hide-sm-only">角色</th>
                <th class="table-date am-hide-sm-only">状态</th>
                <th class="table-set">操作</th>
              </tr>
              </thead>
              <tbody>
             <volist name="data" id="vo">
               <tr>
                <td>{$key}</td>
                <td>{$vo['username']}</td>
                <td>{$vo['truename']}</td>
                <td>{$vo['group_name']}</td>
                <td><php>echo ($vo['status'] == 1 ? '启用':'禁用')</php></td>
                <td>
                  <div class="am-btn-toolbar">
                    <div class="am-btn-group am-btn-group-xs">
                      <a href="{:U('edit_admin',array('id'=>$vo['id']))}"class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</a>
                      <button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only del" nid="{$vo.id}"><span class="am-icon-trash-o"></span> 删除</button>

                    </div>
                  </div>
                </td>
              </tr>
             </volist>
              </tbody>
            </table>
          </form>
        </div>

      </div>
    </div>

    <footer class="admin-content-footer">
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>

  </div>

</block>

<block name="js">
  <script>
    $(".del").click(function () {
      $id=$(this).attr("nid");
      // alert($id);
      if (confirm('确定删除吗，删除后不可恢复')){
        $.ajax({
          type:"post",
          dataType:"json",
          url:"{:U('')}",
          data:{id:$id},
          success:function (data) {
            alert(data.message);
            if (data.code>0){
              window.location.reload();
            } else {
              return false;
            }
          }
        })
      } else {
        return false;
      }
      return false;
    })
  </script>
</block>